package gui;

import   javax.swing.*;
import   java.awt.*;  
import   java.awt.event.KeyEvent;  
import   java.awt.event.KeyListener;  
import   java.awt.event.MouseEvent;  
import   java.awt.event.MouseListener;  
 
public   class MouseKey extends   JFrame   implements   KeyListener,   MouseListener   {
   private   JLabel   lbl,label;  
   private   JTextArea   ta1,ta2;  
   private   JButton   reset,judge;  
   private   Font   ft1,ft2,ft3;  
   public MouseKey(){
       setLayout(null);  
       ft1=new   Font("宋体",Font.BOLD,20);  
       ft2=new   Font("Times   New   Roman",Font.BOLD,20);  
       ft3=new   Font("Times   New   Roman",Font.BOLD,30);  
       lbl=new   JLabel("分数");  
       lbl.setFont(ft1);  
       lbl.setBounds(20,20,50,50);  
       label=new   JLabel("结果");  
       label.setFont(ft1);  
       label.setBounds(20,90,50,50);  
       ta1=new   JTextArea();  
       ta1.setFont(ft1);  
       ta1.setBounds(80,30,90,25);  
       ta2=new   JTextArea();  
       ta2.setFont(ft1);  
       ta2.setBounds(80,100,90,25);  
       reset=new   JButton("重置");  
       reset.setBounds(40,225,60,30);  
       reset.addMouseListener(this);  
       judge=new   JButton("判断");  
       judge.setBounds(120,225,60,30);  
       judge.addMouseListener(this);  
       add(label);  
       add(judge);  
       add(ta2);  
       add(lbl);  
       add(ta1);  
       add(reset);  
       setSize(250,350);  
       setVisible(true);  
   }  
   @Override  
   public   void   keyTyped(KeyEvent   e)   {  
 
   }  
 
   @Override  
   public   void   keyPressed(KeyEvent   e)   {  
   }  
 
   @Override  
   public   void   keyReleased(KeyEvent   e)   {  
   }  
 
   @Override  
   public   void   mouseClicked(MouseEvent   e)   {  
       if(e.getSource().equals(reset)){  
           ta1.setText("");  
           ta2.setText("");  
       }else{  
           int   str1=Integer.valueOf(ta1.getText());  
           if(str1>=60){  
               ta2.setText("及格");  
           }else   {  
               ta2.setText("不及格");  
           }  
       }  
   }  
   @Override  
   public   void   mousePressed(MouseEvent   e)   {  
 
   }  
 
   @Override  
   public   void   mouseReleased(MouseEvent   e)   {  
 
   }  
 
   @Override  
   public   void   mouseEntered(MouseEvent   e)   {  
   }  
 
   @Override  
   public   void   mouseExited(MouseEvent   e)   {  
   }  
 
   public   static   void   main(String[]   args)   {  
        new MouseKey();
    }  
}  